#include "DBQuery.h"
#include "TestBase.h"

TestBase::TestBase()
{
	info.Name = "DBQuery string replacement test 2";
	info.Category = 0x0102;
	info.CategoryName = "DBQuery.BindData<string>";
	info.File = __FILE__;
}

bool TestBase::Run()
{
	std::string format = "{0}{1}.";
	std::string expOutput = "{1}{2}.";
	std::string Data[] = {"{1}", "{2}"};
	std::string output;
	DBQuery query;
	query.SetFormatString(format);
	for (int i = 0, j = sizeof(Data) / sizeof(std::string); i < j; i++)
	{
		query.BindData(i, Data[i]);
	}
	output = query.GetQuery();
	if (output != expOutput)
	{
		std::cout << GetTestInfo()->Name << " failure info" << std::endl;
		std::cout << "Output          : " << output << std::endl;
		std::cout << "Expected output : " << expOutput << std::endl;
		std::cout << "Same?           : " << std::boolalpha << (output == expOutput) << std::endl;
	}
	return output == expOutput;
}